package com.littletrain.config;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import javax.servlet.MultipartConfigElement;

/**
 * @ClassName Config
 * @Description TODO
 * @Author zengwangdong
 * @Date 2019/1/15 18:43
 * @Version 1.0
 */
@Configuration
@ComponentScan(basePackages = {"com.littletrain"})
public class Config {
//    @Bean
//    @Primary
//    public DataSource dataSource() {
//        DruidDataSource druidDataSource = new DruidDataSource();
//        druidDataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
//        druidDataSource.setUrl("jdbc:mysql://192.144.186.185:3306/admin?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true");
//        druidDataSource.setUsername("root");
//        druidDataSource.setPassword("Admin~123");
//        return druidDataSource;
//    }

    @Bean
    public MultipartConfigElement multipartFramedbConfigConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //  单个数据大小
        factory.setMaxFileSize("102400KB");
        /// 总上传数据大小
        factory.setMaxRequestSize("512000KB");
        return factory.createMultipartConfig();
    }
}
